package my.sc;

import my.sc.config.RuleConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author ：Q大侠
 * @date ：Created in 2022/11/18 14:52
 * @description：
 * @modified By：
 * @version:
 */
@SpringBootApplication
@MapperScan(basePackages = "my.sc.dao")
@RibbonClient(value = "shop-product",configuration = RuleConfig.class)
@EnableFeignClients//开启openfeign注解驱动
public class OrderApp {
    public static void main(String[] args) {
        SpringApplication.run(OrderApp.class,args);
    }
    @Bean
    @LoadBalanced//告诉restTemplate使用ribbon完成负载均衡--自动从注册中心拉取服务--内置的负载均衡策略完成服务的调用
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
